<template>
	<view class="page">
		<view class="body">
			<view class="">
				<view class="">
					手机号
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left" style="width: 80%;">
						<input type="number" placeholder="请输入手机号" class="input" v-model="phone" />
					</view>
					<view class="body_cont_right ">
						<view class="btn_cs" @click="chaxun">
							查询
						</view>
					</view>
				</view>
			</view>
			<view class="">
				<view class="">
					账户类型
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left">
						<input type="text" placeholder="请输入账户类型" class="input" v-model="providers_notice" />
					</view>
				</view>
			</view>
			<view class="">
				<view class="">
					账号名称
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left">
						<input type="text" placeholder="请输入账号名称" class="input" v-model="username" />
					</view>
				</view>
			</view>
			<view class="">
				<view class="">
					账户总余额
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left">
						<input type="number" placeholder="请输入账号总余额" class="input" v-model="money" />
					</view>
				</view>
			</view>
			<view class="">
				<view class="">
					操作金额
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left">
						<input type="number" placeholder="请输入操作金额" class="input" v-model="money_1" />
					</view>
				</view>
			</view>
			<view class="">
				<view class="">
					操作说明
				</view>
				<view class="body_cont justify-content-sp">
					<view class="body_cont_left">
						<input type="text" placeholder="请输入操作说明" class="input" v-model="text" />
					</view>
				</view>
			</view>
		</view>
		<view class="btn btn_css" @click="toPath">
			确认
		</view>
	</view>
</template>

<script>
	import {
		doMoney,
		getOneSerivce
	} from '../../api/moneyManagement/index.js'
	export default {
		data() {
			return {
				phone: '',
				username: '',
				money: '',
				providers_notice: '',
				text: '',
				money_1: '',
				user_id: ''
			}
		},
		methods: {
			// 查询商家
			chaxun() {
				var data = {
					phone: this.phone
				};
				getOneSerivce(data).then(res => {
					this.username = res.data.username;
					this.money = res.data.money;
					this.providers_notice = res.data.providers_notice;
					this.user_id = res.data.id;
					uni.showToast({
						"icon": 'none',
						"title": "查询成功"
					})
				})
			},
			toPath() {
				var data = {
					user_id: this.user_id,
					notice: this.text,
					money: this.money_1
				};
				doMoney(data).then(res => {
					uni.showToast({
						"icon": 'none',
						"title": res.msg
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100%;

		.body {
			.body_cont {
				.body_cont_left {
					width: 100%;
					padding: 20rpx 0;

					.input {
						background-color: #f4f6fa;
						padding: 20rpx 10rpx;
						border-radius: 15rpx;
					}
				}

				.body_cont_right {
					padding: 20rpx 0;

					.btn_cs {
						background-color: #4b82ff;
						padding: 20rpx 25rpx;
						border-radius: 15rpx;
						color: white;
					}
				}
			}
		}

		.btn_css {
			margin-top: 50px;
		}
	}
</style>